/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import GUI.JFrameBase;
import com.sun.org.apache.xpath.internal.functions.Function2Args;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import libraries.FunctionLibrary;
import model.DB2Hash;

/**
 *
 * @author Alai
 */
public class ReferralNotePanelView {
    
    private final JFrameBase frame;
    
    public ReferralNotePanelView(JFrameBase frame) {
        this.frame = frame;
    }
    
    
    public void updateReferralNotePanel(DB2Hash worklist2db,DB2Hash study2db,DB2Hash patient2db) {
        try {
            frame.PatientIdTextField.setText(patient2db.get("PatientID"));
            frame.PatientNameTextField.setText(patient2db.get("PatientsName"));
            frame.PatientSurNameTextField.setText(patient2db.get("PatientsSurName"));
            
            String birthDate = frame.parseDate(patient2db.get("PatientsBirthDate"));            
            frame.PatientBirthDateTextField.setText(birthDate);
            frame.PatientSexField.setText(patient2db.get("PatientsSex"));
                    
            frame.RequestingPhysicianTextField.setText(worklist2db.get("RequestingPhysician"));
            frame.RequestedProcedureDescriptionTextField.setText(worklist2db.get("RequestedProcedureDescription"));
            frame.ScheduledProcedureStepDescriptionTextField.setText("ScheduledProcedStepDescription");
            frame.TestPatternTextField.setText(study2db.get("TestPatternsCodeSequence"));
            frame.TestStrategyTextField.setText(study2db.get("TestStrategyCodeSequence"));
            frame.TestModeTextField.setText(study2db.get("ScreeningTestModeCodeSequence"));
            String scheduledDate = frame.parseDate(worklist2db.get("ScheduledProcedureStepDate"));  
            frame.ScheduledProcedureStartDateTextField.setText(scheduledDate);
            String scheduledTime = frame.parseTime2(worklist2db.get("ScheduledProcedureStepTime")); 
            frame.ScheduledProcedureStartTimeTextField.setText(scheduledTime);
            
            frame.ReferralNote.setLocationRelativeTo(frame.Worklist);
            frame.ReferralNote.setVisible(true);
            //String PatientName = referralNote.get("");
            
        } catch (ParseException ex) {
            Logger.getLogger(ReferralNotePanelView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
